package com.study.spmongodb.effective.java;

/**
 * @author MI
 * @version 1.0
 * @date 2020/10/30 14:37
 */
public class Elvis {
    public static final Elvis INSTANCE = new Elvis();

    private void Elviss() {
        System.out.println("私有构造函数");
    }

    public Elvis() {
        System.out.println("gogyo构造函数");
    }

    public void leaveTheBuilding() {
        System.out.println("leaveTheBuilding");
    }

    private static volatile int nextSerialNumber = 0;

    public static int generateSerialNumber() {
        return nextSerialNumber++;
    }

    public static void main(String[] args) {
        System.out.println(INSTANCE);
        System.out.println(INSTANCE);
        System.out.println(INSTANCE);

        System.out.println(generateSerialNumber());
        System.out.println(generateSerialNumber());
        System.out.println(generateSerialNumber());
    }
}
